From cb0b209b775e08b0529786d18079437a58398621 Mon Sep 17 00:00:00 2001
From: Rex Tsai <chihchun@kalug.linux.org.tw>
Date: Wed, 7 Mar 2012 16:44:01 +0800
Subject: [PATCH] Add --icon/-i option, contributed by Whoopie. fixed #14

Signed-off-by: Rex Tsai <chihchun@kalug.linux.org.tw>
---
 remmina/src/remmina.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/remmina/src/remmina.c b/remmina/src/remmina.c
index 2a9c74b..c121880 100644
--- a/remmina/src/remmina.c
+++ b/remmina/src/remmina.c
@@ -55,6 +55,7 @@
 static gboolean remmina_option_quit;
 static gchar *remmina_option_server;
 static gchar *remmina_option_protocol;
+static gboolean remmina_option_icon;
 
 static GOptionEntry remmina_options[] =
 {
@@ -68,6 +69,7 @@
 { "quit", 'q', 0, G_OPTION_ARG_NONE, &remmina_option_quit, "Quit the application", NULL },
 { "server", 's', 0, G_OPTION_ARG_STRING, &remmina_option_server, "Use default server name S", "S" },
 { "protocol", 't', 0, G_OPTION_ARG_STRING, &remmina_option_protocol, "Use default protocol T", "T" },
+{ "icon", 'i', 0, G_OPTION_ARG_NONE, &remmina_option_icon, "Start as tray icon", NULL },
 { NULL } };
 
 static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine *cmdline)
@@ -90,6 +92,7 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine *
 	remmina_option_plugin = NULL;
 	remmina_option_server = NULL;
 	remmina_option_protocol = NULL;
+	remmina_option_icon = FALSE;
 
 	argv = g_application_command_line_get_arguments(cmdline, &argc);
 
@@ -157,6 +160,11 @@ static gint remmina_on_command_line(GApplication *app, GApplicationCommandLine *
 		remmina_exec_command(REMMINA_COMMAND_PLUGIN, remmina_option_plugin);
 		executed = TRUE;
 	}
+	if (remmina_option_icon)
+	{
+		remmina_exec_command(REMMINA_COMMAND_NONE, remmina_option_icon);
+		executed = TRUE;
+	}
 	if (!executed)
 	{
 		remmina_exec_command(REMMINA_COMMAND_MAIN, NULL);
-- 
1.7.10

